
    use: 'ie.ondevice.objectkit.utility.compiler.Compiler';

    
    /**
     * 
     * @const
     * @type {Number}
     * @see #setInjectMode
     */
    AppLoader.BATCH_INJECT= 0;
    
    /**
     * @const
     * @type {Number}
     * @see #setInjectMode
     */
    AppLoader.CLASS_INJECT= 1;

    AppLoader.inherit(Compiler).implement
    (
        {
            /**
             * @private
             * A flag variable used to enable or disable batch injection.
             * Default value is faulse
             * @type {Boolean}
             * @see #enableBatchInject
             * @see #disableBatchInject
             */
            batchInject: null
        
            /**
             * @private
             * A flag variable used to enable or disable writing of debugger
             * statements in source code if code transformation is enabled
             * @type {Boolean}
             * @see #enableDebugger
             * @see #disableDebugger
             */
        ,   debug: null
        
            /**
             * @private
             * A flag variable used to enable or disable code injection
             * alltogether.
             * @type {Boolean}
             * @see #enableInjection
             * @see #disableInjection
             */
        ,   inject: null
            
            /**
             * Load a class and all of its dependencies. Each loaded class
             * will be injected into the global scope independently, and in
             * order of dependency. The entire collated code is available via
             * the #loadedContent property after invokation.
             * 
             * @param {String} entryClass    A canonical class name.
             * @return {void} 
             * @see #loadedContent
             */
        ,   load: function (entryClass) 
            {
                this.parent.compile.call(this, entryClass);
                
                if (this.batchInject) 
                {
                    this.evaluate(this.compiledCode);
                }
                
                return this.compiledCode;
            }
            
            /**
             * Disable code injection altogether. Source code can still be retrieved
             * via the #loadedContent property.
             * @return {void}.
             */
        ,   disableInjection: function () 
            {
                this.inject= false;
            }
            
            /**
             * Enable code injection. 
             * @return {void}
             * @see #enableBatchInject
             * @see #disableBatchInject
             */
        ,   enableInjection: function () 
            {
                this.inject= true;
            }

            /**
             * Instruct the loader to inject all source code
             * simultaneously, rather than one file at a time
             * @return {void}
             * @see #enableInject
             * @see #disableInject
             * @see #disableBatchInject
             */
        ,   enableBatchInject: function () 
            {
                this.batchInject= true;
            }

            /**
             * Instruct the loader to inject each source file independently
             * and in order of dependency
             * @return {void}
             * @see #enableBatchInject
             */
        ,   disableBatchInject: function () 
            {
                this.batchInject= false;
            }
            
            /**
             * Place debug statements in rewritten code, causing
             * supported browers to pause execution after each script injection.
             * @return {void}
             */
        ,   enableDebugger: function () 
            {
                this.classWriter.enableDebugger();
            }
            
            /**
             * Determine if the apploader will inject debugger statements into
             * rewritten source code. As a result, this method will only return
             * true if both code transformation is enabled and debugging is
             * enabled.
             * 
             * @return {Boolean}
             */
        ,   willDebug: function () 
            {
                return true === this.debug;
            }
            
            /**
             * Disable debugger statements from being written into transformed
             * code.
             * 
             * @return {void}
             */
        ,   disableDebugger: function () 
            {
                this.classWriter.disableDebugger();
            }
            
            /**
             * @private
             * @param {String} javaScript
             * @return {void}
             * @throws {Error}x
             */
        ,   evaluate: function (javaScript) 
            {
                if (this.inject)
                    window.eval(javaScript);
            }
            
            /**
             * @inheritDoc
             * @override
             */
        ,   transform: function (classFile) 
            {
                this.parent.transform.call(this, classFile);
                if (this.batchInject) 
                    return; 
                    
                // inject classes individually if not in batch inject mode
                this.evaluate(classFile.sourceCode);
            }
        }
    );
    
    /**
     * AppLoader is a development utility that first scans files for interdependencies
     * and then adds them to the dom by injecting script tags. The advantage of
     * doing this is that the browser should be able to reliably detect the
     * location of errors in individual files, prior to any compression that
     * may be performed before deployment to production servers.
     * 
     * By default, batch injection, code transformation and debugger statements
     * are disabled. In other words, your scripts will be injected one at a
     * time in order of dependency without modifiction to any source code.
     * 
     * @constructor
     * @extends {ie.ondevice.objectkit.utility.compiler.Compiler}
     */
    function AppLoader () 
    {
        Compiler.call(this);
        this.loadedContent= '';
        this.dependents= [];
        this.independents= [];
        this.disableDebugger();
        this.disableCodeTransform();
        this.enableInjection();
        this.disableBatchInject();
    };
